<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <style type="text/css">
            .input-col-m {
                width: 60px;
            }

            .input-col-l {
                width: 80px;
            }

            .input-col-xxl {
                width: 1%;
                text-align: right;
            }

            .col-95 {
                text-align: right;
            }

            .col-5 {
                text-align: left;
            }
        </style>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
        </script>

    </ui:define>

    <ui:define name="content">
        <div style="margin:5px;">
            <h:form id="form">
                <p:growl id="msgs" showDetail="false"/>
                <p:focus for="accountCode"/>
                <p:panel id="input" header="监管账户信息查询">
                    <h:panelGrid columns="2" cellspacing="3" style="width: 100%">
                        <h:panelGrid columns="4" cellspacing="3" style="width:80%"
                                     columnClasses="col-95,col-5,col-95,col-5">

                            <h:outputLabel value="监管账号：" for="accountCode" style="font-weight: bold"/>
                            <h:inputText autocomplete="off" id="accountCode" style="width:182px;"
                                         value="#{rsAccountAction.account.accountCode}">
                            </h:inputText>

                            <h:outputLabel value="账户名称：" for="accountName" style="font-weight: bold"/>
                            <p:inputText id="accountName" value="#{rsAccountAction.account.accountName}"
                                         style="width:182px;"/>

                            <h:outputLabel value="项目名称：" for="proName" style="font-weight: bold"/>
                            <p:inputText id="proName" value="#{rsAccountAction.account.proName}"
                                         style="width:182px;"/>
                        </h:panelGrid>
                        <h:panelGrid style="width:20%">
                            <p:commandButton id="qrybtn" ajax="true" value="查询"
                                             action="#{rsAccountAction.onQuery}"
                                             style="margin-left:15px;width:90px"
                                             update="input,pdt,msgs">
                            </p:commandButton>
                        </h:panelGrid>
                    </h:panelGrid>
                </p:panel>
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="/images/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value=""/>
                    </f:facet>
                </p:ajaxStatus>

                <p:dataTable id="pdt" style="width:100%;"
                             dynamic="true" selectionMode="single"
                             value="#{rsAccountAction.accountList}" var="record"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true" rows="15" paginatorPosition="bottom"
                             rowsPerPageTemplate="100,50,30,15,5" rowKey="Pkid"
                             emptyMessage="数据记录为空...">
                    <p:column headerText="Pkid" style="display:none;">
                        <h:outputText style="display: none;" value="#{record.pkId}"/>
                    </p:column>

                    <p:column headerText="三方协议号" style="text-align:center">
                        <h:outputText value="#{record.agrnum}"/>
                    </p:column>

                    <p:column headerText="监管账号" style="text-align:center">
                        <h:outputText value="#{record.accountCode}"/>
                    </p:column>

                    <p:column headerText="账户名称" style="text-align:left">
                        <h:outputText value="#{record.accountName}"/>
                    </p:column>

                    <p:column headerText="项目名称" style="text-align:left">
                        <h:outputText value="#{record.proName}"/>
                    </p:column>

                    <p:column headerText="项目地址" style="text-align:left">
                        <h:outputText value="#{record.proAddr}"/>
                    </p:column>

                    <p:column headerText="账户余额" style="text-align:right">
                        <h:outputText value="#{record.balance}" style="float: right">
                            <f:convertNumber pattern="###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="可用余额" style="text-align:right">
                        <h:outputText value="#{record.balanceUsable}" style="float: right">
                            <f:convertNumber pattern="###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="状态" style="text-align:center">
                        <h:outputText value="#{rsAccountAction.accountStatus.valueOfAlias(record.statusFlag).title}"/>
                    </p:column>

                    <p:column headerText="限制付款" style="text-align:center">
                        <h:outputText value="#{rsAccountAction.limitStatus.valueOfAlias(record.limitFlag).title}"/>
                    </p:column>

                    <p:column headerText="开户日期" style="text-align:center">
                        <h:outputText value="#{record.startDate}"/>
                    </p:column>

                </p:dataTable>
            </h:form>
        </div>
    </ui:define>

</ui:composition>